function saveQDescription(d, a) {
    recordQuestionEdit(d);
    var c = questionMap[d];
    var b = UEditor.getContent();
    c.description = removeALLHTML(b);
    c.descriptionview = replaceQuestion(b);
    $("#q_name_" + c.id).html(c.descriptionview);
    questionMap[d] = c;
    refreshQuestionHeight(c.id)
}
function saveQQDescription(d, c) {
    recordQuestionEdit(d);
    var b = questionMap[d];
    var a = getQuestionFromQuestion(b, c);
    a.description = removeALLHTML($("#qleftquestiondescription_" + d + "_" + c).val());
    a.descriptionview = replaceNormalHTML($("#qleftquestiondescription_" + d + "_" + c).val());
    $("#q_question_" + b.id + "_" + a.id).html(a.descriptionview);
    saveQuestionToQuestion(b, a);
    refreshQuestionHeight(b.id)
}
function saveQAName(e, d) {
    recordQuestionEdit(e);
    var c = questionMap[e];
    var b = getAnswerFromQuestion(c, d);
    b.name = replaceNormalHTML($("#qleftanswername_" + e + "_" + d).val());
    if (c.type == 6 && c.typeid == 5) {
        $("#q_answer_" + c.id + "_" + b.id).html(getSingleOpenAnswerInnerHtml(c, b))
    } else {
        $("#q_answer_" + c.id + "_" + b.id).html(getSingleAnswerInnerHtml(b))
    }
    saveAnswerToQuestion(c, b);
    refreshQuestionHeight(c.id)
}
function saveQAPoint(e, d) {
    recordQuestionEdit(e);
    var c = questionMap[e];
    var b = getAnswerFromQuestion(c, d);
    if (isNum($("#qleftanswerpoint_" + e + "_" + d).val())) {
        b.point = parseInt($("#qleftanswerpoint_" + e + "_" + d).val(), 10)
    } else {
        b.point = 0
    }
    saveAnswerToQuestion(c, b);
    refreshQuestionHeight(c.id)
}
function saveQAHasother(e, d) {
    recordQuestionEdit(e);
    var c = questionMap[e];
    var b = getAnswerFromQuestion(c, d);
    b.hasother = $("#qleftanswerhasother_" + e + "_" + d).is(":checked") ? 1: 0;
    $("#q_answers_" + c.id).html(getQuestionAnswerHtml(c));
    saveAnswerToQuestion(c, b);
    refreshQuestionHeight(c.id)
}
function addQQQuestion(f, e) {
    if ($("[id^=qleftquestion_" + f + "_]").length >= childQuestionCount && childQuestionCount != 0) {
        showErrorMsg("showquestionserror", "showquestionserrormsg", formatMessage("edit_010", childQuestionCount));
        return
    }
    recordQuestionEdit(f);
    var c = questionMap[f];
    var b = getQuestionFromQuestion(c, e);
    var d = new Question({});
    var a = getLeftQuestionQuestionHtml(c, d);
    $("#qleftquestion_" + c.id + "_" + b.id).after(a);
    saveQuestionToQuestion(c, d, e);
    c = questionMap[f];
    $("#q_answers_" + c.id).html(getQuestionAnswerHtml(c));
    refreshQuestionHeight(c.id)
}
function deleteQQQuestion(d, c) {
    recordQuestionEdit(d);
    var b = questionMap[d];
    if ($("[id^=qleftquestion_]").length == 1) {
        var a = getQuestionFromQuestion(b, c);
        $("#qleftquestiondescription_" + d + "_" + a.id).val("");
        a.description = "";
        $("#q_question_" + b.id + "_" + a.id).html(a.description);
        saveQuestionToQuestion(b, a)
    } else {
        $("#qleftquestion_" + b.id + "_" + c).remove();
        removeQuestionToQuestion(b, c)
    }
    b = questionMap[d];
    $("#q_answers_" + b.id).html(getQuestionAnswerHtml(b));
    refreshQuestionHeight(b.id)
}
function addQAAnswer(h, g) {
    var f = questionMap[h];
    if (!checkAnswersCount(f)) {
        return
    }
    recordQuestionEdit(h);
    var f = questionMap[h];
    var c = getAnswerFromQuestion(f, g);
    var d = new Answer({});
    var b = getMaxPoint(f) + 1;
    d.point = b;
    var e = getLeftQuestionAnswerHtml(f, d, checkPointIsHidden(f.id), checkHasotherIsHidden(f.id));
    $("#qleftanswer_" + f.id + "_" + c.id).after(e);
    saveAnswerToQuestion(f, d, g);
    f = questionMap[h];
    $("#q_answers_" + f.id).html(getQuestionAnswerHtml(f));
    refreshQuestionHeight(f.id);
    bindQuestionAnswerPic(f.id, d.id);
    if (f.type == 1 && $("#qleftanswers").find(".drag-on").size() >= 10) {
        checkAnswersTips(f.id, 1)
    }
}
function checkAnswersCount(a) {
    if ((a.type == 1 || a.type == 2) && a.answers.length >= answerCount && answerCount != 0) {
        showErrorMsg("showanswerserror", "showanswerserrormsg", formatMessage("edit_009", answerCount));
        return false
    }
    if ((a.type == 41 || a.type == 42) && a.answers.length >= childAnswerCount && childAnswerCount != 0) {
        showErrorMsg("showanswerserror", "showanswerserrormsg", formatMessage("edit_009", childAnswerCount));
        return false
    }
    return true
}
function deleteQAAnswer(e, d) {
    recordQuestionEdit(e);
    var c = questionMap[e];
    if (!$("#qleftanswer_" + e + "_" + d).hasClass("dropReq")) {
        if ($("[id^=qleftanswer_]").not(".pic-addr").not(".dropReq").not(".dropReq-gray").length == 1) {
            var b = getAnswerFromQuestion(c, d);
            $("#qleftanswername_" + e + "_" + d).val("");
            b.name = "";
            $("#q_answer_" + c.id + "_" + b.id).html(b.name);
            saveAnswerToQuestion(c, b);
            return
        }
    }
    if ($("#qleftanswer_" + e + "_" + d).hasClass("dropReq")) {
        c.allowother = 0;
        $("#qlefteditallowother").attr("checked", false);
        $("#qleftanswer_" + e + "_" + d).removeClass("dropReq").addClass("dropReq-gray");
        $("#qleftanswername_" + e + "_" + d).attr("disabled", "disabled");
        $("#qleftanswerpoint_" + e + "_" + d).attr("disabled", "disabled");
        $("#qleftanswername_" + e + "_" + d).val("其他");
        $("#qleftanswerpoint_" + e + "_" + d).val(0)
    } else {
        $("#qleftanswer_" + c.id + "_" + d).remove()
    }
    removeAnswerToQuestion(c, d);
    $("#q_answers_" + c.id).html(getQuestionAnswerHtml(c));
    refreshQuestionHeight(c.id)
}
function addOpenQAnswer(h, g) {
    var f = questionMap[h];
    if (f.answers.length >= 10) {
        return
    }
    recordQuestionEdit(h);
    var c = getAnswerFromQuestion(f, g);
    var d = new Answer({});
    var b = getMaxPoint(f) + 1;
    d.point = b;
    var e = getLeftSingleOpenQuestionAnswerHtml(f, d);
    $("#qleftanswer_" + f.id + "_" + c.id).after(e);
    saveAnswerToQuestion(f, d, g);
    f = questionMap[h];
    $("#q_answers_" + f.id).html(getSingleOpenAnswerHtml(f));
    refreshQuestionHeight(f.id);
    refreshOpenQuestionAnswers(f.id)
}
function deleteOpenQAnswer(c, b) {
    var a = questionMap[c];
    if (a.answers.length <= 1) {
        return
    }
    recordQuestionEdit(c);
    $("#qleftanswer_" + a.id + "_" + b).remove();
    removeAnswerToQuestion(a, b);
    $("#q_answers_" + a.id).html(getSingleOpenAnswerHtml(a));
    refreshQuestionHeight(a.id);
    refreshOpenQuestionAnswers(a.id)
}
function refreshOpenQuestionAnswers(b) {
    var a = questionMap[b];
    if (a.answers.length >= 10) {
        $("#showopenanswerserror").show();
        $("[id^=qleftopenanswer_" + b + "_]").attr("src", imagePath + "add-gray.png")
    } else {
        $("#showopenanswerserror").hide();
        $("[id^=qleftopenanswer_" + b + "_]").attr("src", imagePath + "add.png")
    }
}
function showLeftImg(b) {
    var a = questionMap[b];
    if (a.imageurl != null && a.imageurl != "") {
        if ($("#qleftshowimg").is(":visible")) {
            $("#qleftshowimg").hide()
        } else {
            $("#qleftshowimg").show()
        }
    } else {
        if ($("#qlefteditimg").css("display") != "none") {
            $("#qlefteditimg").hide()
        } else {
            $("#qlefteditimg").show()
        }
    }
}
function showLeftImgTab(b, a) {
    $("[id^=qlefteditimgtab0]").removeClass("current");
    $("#qlefteditimgtab0" + a).addClass("current");
    $("[id^=qlefteditimg0]").hide();
    $("#qlefteditimg0" + a).show()
}
function saveQImg(a) {
    if ($.trim($("#qlefteditimgurl").val()) == "") {
        return
    }
    saveQImgAction(a, 2, $.trim($("#qlefteditimgurl").val()))
}
function saveQImgAction(g, a, c) {
    recordQuestionEdit(g);
    var e = questionMap[g];
    var f = "";
    if (a == 1) {
        f = ctx + "/" + c
    } else {
        f = c
    }
    var d = encodeURI(c);
    var b = decodeURI(c);
    if (c == b) {
        e.imageurl = d
    } else {
        e.imageurl = c
    }
    e.imagetype = 2;
    $("#qleftshowimgurl").attr("src", f);
    $("#q_img_" + g).html(getImgInnerHtml(e));
    $("#qleftimagetype" + e.imagetype + "_" + e.id).attr("checked", true);
    if (e.imagetype == 4) {
        $("#qleftimageheight_" + e.id).val(e.imageheight);
        $("#qleftimagewidth_" + e.id).val(e.imagewidth)
    }
    $("#q_img_" + e.id).show();
    $("#qlefteditimgurl").val("");
    setTimeout(function() {
        $("#qlefteditimg").hide()
    },
    100);
    questionMap[g] = e;
    $("#qleftshowimg").show();
    refreshQuestionHeight(g)
}
function deleteQImg(b) {
    recordQuestionEdit(b);
    var a = questionMap[b];
    a.imageurl = "";
    $("#q_img_" + a.id).hide();
    $("#q_img_" + b).html(getImgInnerHtml(a));
    $("#qleftshowimg").hide();
    questionMap[b] = a;
    refreshQuestionHeight(b)
}
function changeQImgType(c) {
    var b = parseInt($("input[name=qleftimagetype_" + c + "]:checked").val(), 10);
    if (b == 4) {
        if (!/^[0-9]*$/.test($.trim($("#qleftimagewidth_" + c).val())) || !/^[0-9]*$/.test($.trim($("#qleftimageheight_" + c).val()))) {
            alert("请完整输入图片的宽度及高度。");
            return
        }
    }
    recordQuestionEdit(c);
    var a = questionMap[c];
    a.imagetype = b;
    if (b == 4) {
        a.imagewidth = parseInt($("#qleftimagewidth_" + c).val(), 10);
        a.imageheight = parseInt($("#qleftimageheight_" + c).val(), 10)
    }
    $("#q_img_" + c).html(getImgInnerHtml(a));
    questionMap[c] = a;
    refreshQuestionHeight(c);
    showLeftImg(c)
}
function checkQImgType(b, a) {
    if (a == 4) {
        $("#qleftimagewidth_" + b).removeClass("text-gray").addClass("text");
        $("#qleftimageheight_" + b).removeClass("text-gray").addClass("text");
        if ($("#qleftimagewidth_" + b).val() == QIMAGE_DEFAULT_WIDTH_TEXT) {
            $("#qleftimagewidth_" + b).addClass("gray9")
        }
        if ($("#qleftimageheight_" + b).val() == QIMAGE_DEFAULT_HEIGHT_TEXT) {
            $("#qleftimageheight_" + b).addClass("gray9")
        }
    } else {
        $("#qleftimagewidth_" + b).removeClass("text").removeClass("gray9").addClass("text-gray");
        $("#qleftimageheight_" + b).removeClass("text").removeClass("gray9").addClass("text-gray")
    }
}
function showLeftAImg(e, d) {
    var c = questionMap[e];
    var b = getAnswerFromQuestion(c, d);
    $("[id^=qleftanswerimgDIV_" + c.id + "_]").css("position", "auto").css("z-index", 1);
    if (b.id != null && b.imageurl != null && b.imageurl != "") {
        if ($("#qleftshowimg_" + c.id + "_" + b.id).is(":visible")) {
            $("#qleftshowimg_" + c.id + "_" + b.id).hide();
            $("#qleftanswerimgDIV_" + c.id + "_" + b.id).css("position", "auto").css("z-index", 1)
        } else {
            $("#qleftshowimg_" + c.id + "_" + b.id).show();
            $("#qleftanswerimgDIV_" + c.id + "_" + b.id).css("position", "relative").css("z-index", 2)
        }
    } else {
        if ($("#qlefteditimg_" + c.id + "_" + b.id).css("display") != "none") {
            $("#qlefteditimg_" + c.id + "_" + b.id).hide();
            $("#qleftanswerimgDIV_" + c.id + "_" + b.id).css("position", "auto").css("z-index", 1)
        } else {
            $("#qlefteditimg_" + c.id + "_" + b.id).show();
            $("#qleftanswerimgDIV_" + c.id + "_" + b.id).css("position", "relative").css("z-index", 2)
        }
    }
}
function showLeftAImgTab(c, b, a) {
    $("[id^=qlefteditimg_" + c + "_" + b + "_tab0]").removeClass("current");
    $("#qlefteditimg_" + c + "_" + b + "_tab0" + a).addClass("current");
    $("[id^=qlefteditimg_" + c + "_" + b + "_0]").hide();
    $("#qlefteditimg_" + c + "_" + b + "_0" + a).show()
}
function saveQAImg(b, a) {
    if ($.trim($("#qleftaddimgurl_" + b + "_" + a).val()) == "") {
        return
    }
    saveQAImgAction(b, a, 2, $.trim($("#qleftaddimgurl_" + b + "_" + a).val()))
}
function saveQAImgAction(e, f, h, d) {
    recordQuestionEdit(e);
    var c = questionMap[e];
    var i = getAnswerFromQuestion(c, f);
    var j = "";
    if (h == 1) {
        j = ctx + "/" + d
    } else {
        j = d
    }
    var g = encodeURI(d);
    var b = decodeURI(d);
    if (d == b) {
        i.imageurl = g
    } else {
        i.imageurl = d
    }
    i.imagetype = 2;
    saveAnswerToQuestion(c, i);
    $("#qleftshowimgurl_" + c.id + "_" + i.id).attr("src", j);
    $("#qleftaddimgurl_" + c.id + "_" + i.id).val("");
    setTimeout(function() {
        $("#qlefteditimg_" + c.id + "_" + i.id).hide()
    },
    100);
    $("#qleftanswerimagetype" + i.imagetype + "_" + c.id + "_" + i.id).attr("checked", true);
    $("#q_answer_" + c.id + "_" + i.id).html(getSingleAnswerInnerHtml(i));
    $("#qleftanswerimgDIV_" + c.id + "_" + i.id).css("position", "auto").css("z-index", 2);
    $("#qleftshowimg_" + e + "_" + f).show();
    refreshQuestionHeight(e)
}
function deleteQAImg(e, d) {
    recordQuestionEdit(e);
    var c = questionMap[e];
    var b = getAnswerFromQuestion(c, d);
    b.imageurl = "";
    $("#qleftshowimg_" + c.id + "_" + b.id).hide();
    $("#q_answer_" + c.id + "_" + b.id).html(getSingleAnswerInnerHtml(b));
    saveAnswerToQuestion(c, b);
    refreshQuestionHeight(e)
}
function changeQAImgType(f, d) {
    var e = parseInt($("input[name=qleftanswerimagetype_" + f + "_" + d + "]:checked").val(), 10);
    if (e == 4) {
        if (!/^[0-9]*$/.test($.trim($("#qleftanswerimagewidth_" + f + "_" + d).val())) || !/^[0-9]*$/.test($.trim($("#qleftanswerimageheight_" + f + "_" + d).val()))) {
            alert("请完整输入图片的宽度及高度。");
            return
        }
    }
    recordQuestionEdit(f);
    var c = questionMap[f];
    var b = getAnswerFromQuestion(c, d);
    b.imagetype = e;
    if (e == 4) {
        b.imagewidth = parseInt($("#qleftanswerimagewidth_" + f + "_" + d).val(), 10);
        b.imageheight = parseInt($("#qleftanswerimageheight_" + f + "_" + d).val(), 10)
    }
    saveAnswerToQuestion(c, b);
    $("#q_answer_" + c.id + "_" + b.id).html(getSingleAnswerInnerHtml(b));
    questionMap[f] = c;
    refreshQuestionHeight(f);
    showLeftAImg(f, d)
}
function checkAImgType(c, b, a) {
    if (a == 4) {
        $("#qleftanswerimagewidth_" + c + "_" + b).removeClass("text-gray");
        $("#qleftanswerimageheight_" + c + "_" + b).removeClass("text-gray");
        if ($("#qleftanswerimagewidth_" + c + "_" + b).val() == AIMAGE_DEFAULT_WIDTH_TEXT) {
            $("#qleftanswerimagewidth_" + c + "_" + b).addClass("gray9")
        } else {
            $("#qleftanswerimagewidth_" + c + "_" + b).addClass("text")
        }
        if ($("#qleftanswerimageheight_" + c + "_" + b).val() == AIMAGE_DEFAULT_HEIGHT_TEXT) {
            $("#qleftanswerimageheight_" + c + "_" + b).addClass("gray9")
        } else {
            $("#qleftanswerimageheight_" + c + "_" + b).addClass("text")
        }
    } else {
        $("#qleftanswerimagewidth_" + c + "_" + b).removeClass("text").removeClass("gray9").addClass("text-gray");
        $("#qleftanswerimageheight_" + c + "_" + b).removeClass("text").removeClass("gray9").addClass("text-gray")
    }
}
function saveRandomize(b) {
    recordQuestionEdit(b);
    var a = questionMap[b];
    if ($("#qlefteditrandomize").attr("checked")) {
        a.randomize = 1
    } else {
        a.randomize = 0
    }
    questionMap[b] = a
}
function saveGridRandomize(b) {
    recordQuestionEdit(b);
    var a = questionMap[b];
    if ($("#qlefteditgridrandomize").attr("checked")) {
        a.gridrandomize = 1
    } else {
        a.gridrandomize = 0
    }
    questionMap[b] = a
}
function saveType(f) {
    recordQuestionEdit(f);
    var d = questionMap[f];
    var e = QuestionTypeMap[$("#qleftedittype").val()];
    if (checkNormalType(e.type, e.typeid, d)) {
        if (Math.abs(d.type - e.type) == 1) {} else {
            if (e.type == 1 || e.type == 2) {
                d.questions = new Array()
            } else {
                d.questions = getDefaultQuestionList();
                for (var b = 0; b < d.answers.length; b++) {
                    d.answers[b].imageurl = ""
                }
            }
        }
    } else {
        d.answers = new Array();
        d.questions = new Array();
        if ((e.type == 1 || e.type == 2 || e.type == 41 || e.type == 42) && e.typeid == 1) {
            d.answers = getDefaultAnswerList();
            if (e.type >= 41) {
                d.questions = getDefaultQuestionList()
            }
        }
        if (e.typeid == 3) {
            d.answers = getDefaultColorAnswerList()
        }
        if (e.typeid == 18) {
            d.answers = getDefaultPointAnswerList()
        }
        if (e.type == 6 && (e.typeid == 1 || e.typeid == 5 || e.typeid == 13)) {
            d.format = 1;
            d.rangeformat = 0;
            d.rangemin = 0;
            d.rangemax = 0;
            if (e.typeid == 5) {
                var c = new Array();
                c.push(new Answer({
                    id: (new Date()).getTime(),
                    name: "",
                    point: 1
                }));
                d.answers = c
            }
        }
        if (e.type == 6 && (e.typeid <= 11 && e.typeid >= 8)) {
            d.predefine = "";
            if (e.typeid == 9) {
                d.format = 6
            }
        }
        if (e.type == 6 && e.typeid == 12) {
            d.predefine = "";
            d.format = 4
        }
        if (e.type == 0 && e.typeid == 1) {
            d.instruction = ""
        }
    }
    var a = getDefaultQuestion(d);
    if (a.description == $("#q_name_" + d.id).html()) {
        d.description = e.description;
        d.descriptionview = e.description
    }
    if (d.typeid == 1 && e.typeid == 1 && (d.type == 1 && e.type == 2 || d.type == 2 && e.type == 1)) {} else {
        d.allowother = 0
    }
    d.type = e.type;
    d.typeid = e.typeid;
    if (d.type == 41 || d.type == 42) {
        for (var b = 0; b < d.answers.length; b++) {
            d.answers[b].hasother = 0
        }
    }
    if (e.type == 1 || e.type == 2 || e.type == 41 || e.type == 42) {
        d.required = 1
    }
    questionMap[d.id] = d;
    $("#qeditshow").html(getLeftShowHtml(d));
    $("#question_" + f).html(getRightQuestionInnerHtml(d));
    $("#question_" + f).removeClass("section");
    if (d.type == 0) {
        $("#question_" + f).addClass("section")
    }
    if (d.type == 6 && d.typeid == 9) {
        showDate(d.id)
    }
    if (d.type == 6 && d.typeid == 10) {
        showTime(d.id)
    }
    if (d.type == 2 && d.format == 12) {
        d.format = 9;
        saveFormat(d.id)
    }
    showSort(d);
    refreshNO();
    refreshQuestionHeight(d.id);
    showEditor(d);
    bindQuestionUploadPic(d)
}
function checkNormalType(b, a, c) {
    if ((b == 1 || b == 2 || b == 41 || b == 42) && (c.type == 1 || c.type == 2 || c.type == 41 || c.type == 42) && a == 1 && c.typeid == 1) {
        return true
    } else {
        return false
    }
}
var editMultiItem = new Array();
var editMultiItem_qid = "";
var editMultiItem_type = 0;
function showEditMultiItem(c, j) {
    editMultiItem = new Array();
    editMultiItem_qid = c;
    editMultiItem_type = j;
    var b = questionMap[c];
    var g = "";
    var f = "";
    var k = "";
    if (j == 1) {
        k = "每行请输入一个选项";
        for (var d = 0; d < b.answers.length; d++) {
            var l = b.answers[d];
            f = "";
            if (d != 0) {
                f = "\r\n"
            }
            if (b.allowother != 1 || d != (b.answers.length - 1)) {
                g += f + l.name;
                editMultiItem.push({
                    id: l.id,
                    imageurl: l.imageurl,
                    point: l.point
                })
            }
        }
    } else {
        k = "每行请输入一个子问题";
        for (var d = 0; d < b.questions.length; d++) {
            var h = b.questions[d];
            f = "";
            if (d != 0) {
                f = "\r\n"
            }
            g += f + h.descriptionview;
            editMultiItem.push({
                id: h.id
            })
        }
    }
    var e = "";
    e += '<div class="save-info" style="width: 480px;"><h1 id="multiEditName">批量编辑</h1><div id="multiEditTitle">' + k + "</div></div>";
    e += '<div><textarea class="maxtextarea" rows="" cols="" id="multiEdit" onpaste="checkPaste()">' + g + "</textarea></div>";
    e += '<div class="flow-btn"> <a class="yellowbtn" id="" href="javascript:void(0);" onclick="saveEditMultiItem(\'multiEditDIV\');return false;">确定</a> &nbsp;&nbsp;&nbsp;<a id="" onclick="cancelEditMultiItem(\'multiEditDIV\');return false;" class="btn" href="javascript:void(0);">取消</a></div>';
    showMiddleDialog("multiEditDIV", e)
}
var saveEditMultiItemtemp = false;
function saveEditMultiItem(c) {
    saveEditMultiItemtemp = true;
    var b = questionMap[editMultiItem_qid];
    recordQuestionEdit(editMultiItem_qid);
    var l = $("#multiEdit").val().replace(/(\r)*\n/g, "@#@");
    var j = l.split("@#@");
    var o = (new Date()).getTime();
    if (editMultiItem_type == 1) {
        var e = new Array();
        var n = getMaxPoint(b);
        var p = 0;
        for (var h = 0; h < j.length; h++) {
            var g = j[h].replace(/\s/g, "").replace(/"/g, "“").replace(/'/g, "‘");
            var f = new Answer({});
            f.name = replaceNormalHTML(g);
            f.id = o + h;
            if (b.allowother == 1 && h < editMultiItem.length || (b.allowother != 1 && h < editMultiItem.length)) {
                f.id = editMultiItem[h].id;
                f.point = editMultiItem[h].point
            } else {
                p++;
                f.point = n + p
            }
            if (h < editMultiItem.length && editMultiItem[h].imageurl != "") {
                f.imageurl = editMultiItem[h].imageurl
            }
            e.push(f)
        }
        if (b.allowother == 1) {
            var m = b.answers[b.answers.length - 1];
            e.push(new Answer({
                id: m.id,
                name: m.name,
                hasother: 1,
                point: m.point
            }))
        }
        b.answers = e;
        $("#qleftanswers").html(getLeftQuestionAnswersHtml(b, checkPointIsHidden(b.id)))
    } else {
        var d = new Array();
        for (var h = 0; h < j.length; h++) {
            var g = j[h].replace(/\s/g, "").replace(/"/g, "“").replace(/'/g, "‘");
            var k = new Question({});
            k.id = o + h;
            k.descriptionview = replaceNormalHTML(g);
            k.description = removeALLHTML(g);
            if (h < editMultiItem.length && editMultiItem[h].imageurl != "") {
                k.id = editMultiItem[h].id
            }
            d.push(k)
        }
        b.questions = d;
        $("#qleftquestions").html(getLeftQuestionQuestionsHtml(b))
    }
    $("#q_answers_" + b.id).html(getQuestionAnswerHtml(b));
    questionMap[editMultiItem_qid] = b;
    if (b.type == 1 && $("#qleftanswers").find(".drag-on").size() >= 10) {
        checkAnswersTips(b.id, 0)
    }
    closeArtDialog(c);
    refreshQuestionHeight(b.id);
    showLeftQuestion(targetid)
}
function cancelEditMultiItem(a) {
    editMultiItem = new Array();
    editMultiItem_qid = "";
    editMultiItem_type = 0;
    closeArtDialog(a)
}
function autoCreateOption(c, a, d, b) {
    if (a.keyCode != 13) {
        return false
    }
    if ($(c).parent().attr("id") == $("#qleftanswers > li.drag-on").last().attr("id")) {
        addQAAnswer(d, b)
    } else {
        $(c).parent().next().children().first().focus()
    }
    if ($(c).parent().attr("id") == $("#qleftquestions > li.drag-on").last().attr("id")) {
        addQQQuestion(d, b)
    } else {
        $(c).parent().next().children().first().focus()
    }
    return false
};